<?php
//Ansluta
include "Config.php";

$id = mysql_escape_string($_GET["id"]);

//Skaffa data
$torrents_data = mysql_query("SELECT data,name FROM `torrents` WHERE id='$id';") or die(mysql_error());
$row = mysql_fetch_array($torrents_data);
$name = $row['name'];

//Skicka header
header('Content-Disposition: attachment; filename="'.$name.'.torrent"');
echo $row['data'];
?>